/*
 * @Descripttion: 
 * @version: 
 * @Author: TT
 * @Date: 2023-08-26 10:22:03
 * @LastEditors: TT
 * @LastEditTime: 2023-10-31 17:00:10
 */

import 'package:flutter/material.dart';
import 'package:hzy_project_template/base_ui_config/base_ui_config_index.dart';

import 'package:hzy_project_template/config/config_index.dart';
import 'package:hzy_project_template/pages/login/vm/login_vm.dart';
import 'package:hzy_project_template/pages/login/widgets/compontents_index.dart';
import 'package:hzy_project_template/utils/getx_util_tool.dart';

import '../config/note_login_config.dart';

class NoteForgetV extends CommonGetXV<NoteForgetC> {
  NoteForgetV({Key? key}) : super(key: key);
  @override
  NoteForgetC get controller => Get.put(NoteForgetC());

  @override
  Widget createBody({
    required BuildContext context,
    BoxConstraints? constraints,
  }) {
    Widget body = LoginChildWidget(
      config: controller.noteLoginConfig,
      tapCallback: (imageModel) {
        controller.tapDo();
      },
    );
    return body;
  }
}

class NoteForgetC extends CommonGetXController {
  // --------- 属性 --------- //
  NoteLoginConfig noteLoginConfig = NoteLoginConfig(
    headerType: 2,
    nickNameType: 2,
    inputStype: 2,
    bottomType: 3,
    text: LaunchIdConfig.done.tr,
  );
  late String account;
  // --------- 生命周期  --------- //
  @override
  configDefault() {
    noteLoginConfig.accountInputModel.text = currentGetArguments();
    noteLoginConfig.accountInputModel.enabled = false;
    account = currentGetArguments();
    isShowAppBar = false;
    safeAreatop = false;
    scallBackGroundColor = Colors.white;
    safeAreabottm = true;
  }

  // --------- 数据处理  --------- //

  // --------- 触发事件  --------- //

  tapDo() async {
    await LoginVM().configLogin(
      account: account,
      pwd: noteLoginConfig.passWordInputModel.text!,
      isLogin: false,
    );
  }
}
